package com.ly.mapper;

import com.ly.bean.EasybuyProduct;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
@author 李岩
@date 2021/12/14-13:52
@describe
*/
@Mapper
public interface EasybuyProductMapper {
    /**
     * delete by primary key
     * @param id primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Integer id) throws Exception;

    /**
     * insert record to table
     * @param record the record
     * @return insert count
     */
    int insert(EasybuyProduct record) throws Exception;

    /**
     * insert record to table selective
     * @param record the record
     * @return insert count
     */
    int insertSelective(EasybuyProduct record) throws Exception;

    /**
     * 根据商品id查询该商品信息
     */
    EasybuyProduct selectProductByPrimaryKey(Integer id) throws Exception;

    //根据登录卖家的信息，获取卖家中售卖的商品列表
    List<EasybuyProduct> selectProductBySellerId(String sellerId) throws Exception;

    /**
     * 获取前六件商品
     */
    List<EasybuyProduct> selectSixByCategoryLevel1Id(Integer categoryLevel1Id) throws Exception;

    //查询所有商品
    List<EasybuyProduct> selectAllProduct() throws Exception;
    /**
     * update record selective
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(EasybuyProduct record) throws Exception;

    /**
     * update record
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(EasybuyProduct record) throws Exception;

    //管理员审核通过以后把商品表里面的 库存减去抢购的数量
    void updateProductStatusByPid(@Param("num")Integer num,@Param("id")Long id) throws Exception;
}